136. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2020-08-14 00:01:37 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

136.1 Files compared

#LocationFileLast Modified
1Porto v3.2.3/Magento 2.x/Porto Theme/app/design/frontend/Smartwave/porto/Mageplaza_LayeredNavigation/web/jslayer.js2018-06-24 01:56:42 +0000
22020-08-14 00:01:37 +0000

136.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged00
Changed00
Inserted00
Removed1314

136.3 Comparison options

WhitespaceConsecutive whitespace is treated as a single space
Character caseDifferences in character case are significant
Line endingsDifferences in line endings (CR and LF characters) are ignored
CR/LF charactersNot shown in the comparison detail
Active line-pairing rules

136.4 Active regular expressions

No regular expressions were active.

136.5 Comparison detail

1 /**    
2  * Copyright 2016 Mageplaza. All rights reserved.    
3  * See https://www.mageplaza.com/LICENSE.txt for license details.    
4  */    
5 define([    
6     'jquery',    
7     'jquery/ui',    
8     'productListToolbarForm'    
9 ], function ($) {    
10     "use strict";    
11     var next_page = "";    
12     var loading = false;    
13     var infinite_loaded_count = 0;    
14     var active = false;    
15     $.widget('mageplaza.layer', {    
16     
17         options: {    
18             productsListSelector: '#layer-product-list',    
19             navigationSelector: '#layered-filter-block'    
20         },    
21     
22         _create: function () {    
23             this.initProductListUrl();    
24             this.initObserve();    
25             this.initLoading();    
26             this.inFinite();    
27         },    
28     
29         initProductListUrl: function () {    
30             var self = this;    
31             $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) {    
32                 var urlPaths = this.options.url.split('?'),    
33                     baseUrl = urlPaths[0],    
34                     urlParams = urlPaths[1] ? urlPaths[1].split('&') : [],    
35                     paramData = {},    
36                     parameters;    
37                 for (var i = 0; i < urlParams.length; i++) {    
38                     parameters = urlParams[i].split('=');    
39                     paramData[parameters[0]] = parameters[1] !== undefined    
40                         ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20'))    
41                         : '';    
42                 }    
43                 paramData[paramName] = paramValue;    
44                 if (paramValue == defaultValue) {    
45                     delete paramData[paramName];    
46                 }    
47                 paramData = $.param(paramData);    
48     
49                 self.ajaxSubmit(baseUrl + (paramData.length ? '?' + paramData : ''));    
50             }    
51         },    
52     
53         initObserve: function () {    
54             var self = this;    
55             var aElements = this.element.find('a');    
56             aElements.each(function (index) {    
57                 var el = $(this);    
58                 var link = self.checkUrl(el.prop('href'));    
59                 if(!link) return;    
60     
61                 el.bind('click', function (e) {    
62                     if (el.hasClass('swatch-option-link-layered')) {    
63                         var childEl = el.find('.swatch-option');    
64                         childEl.addClass('selected');    
65                     } else {    
66                         var checkboxEl = el.find('input[type=checkbox]');    
67                         checkboxEl.prop('checked', !checkboxEl.prop('checked'));    
68                     }    
69     
70                     self.ajaxSubmit(link);    
71                     e.stopPropagation();    
72                     e.preventDefault();    
73                 });    
74     
75                 var checkbox = el.find('input[type=checkbox]');    
76                 checkbox.bind('click', function (e) {    
77                     self.ajaxSubmit(link);    
78                     e.stopPropagation();    
79                 });    
80             });    
81     
82             $(".filter-current a").bind('click', function (e) {    
83                 var link = self.checkUrl($(this).prop('href'));    
84                 if(!link) return;    
85     
86                 self.ajaxSubmit(link);    
87                 e.stopPropagation();    
88                 e.preventDefault();    
89             });    
90     
91             $(".filter-actions a").bind('click', function (e) {    
92                 var link = self.checkUrl($(this).prop('href'));    
93                 if(!link) return;    
94     
95                 self.ajaxSubmit(link);    
96                 e.stopPropagation();    
97                 e.preventDefault();    
98             });    
99         },    
100     
101         checkUrl: function (url) {    
102             var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/;    
103     
104             return regex.test(url) ? url : null;    
105         },    
106     
107         initLoading: function () {    
108     
109         },    
110     
111         inFinite: function() {    
112             var self = this;    
113             next_page = "";    
114             if($(self.options.productsListSelector +' .infinite-loader').length > 0){    
115                 active = true;    
116             }    
117             $(".pages-items li > a.next").each(function(){    
118                 next_page = $(this).attr("href");    
119             });    
120             $(window).scroll(function(){    
121                 if(!loading && next_page && active && $(window).scrollTop() >= $(".infinite-loader").offset().top-$(window).height()+100){    
122                     if(infinite_loaded_count < 2){    
123                         loading = true;    
124                         $(".pages-items li > a.next").each(function(){    
125                             next_page = $(this).attr("href");    
126                         });    
127                         self.ajaxInfinite(next_page);    
128                     }    
129                 }    
130             });    
131             $(".infinite-loader .btn-load-more").click(function(){    
132                 if(!loading && next_page && infinite_loaded_count >= 2){    
133                     loading = true;    
134                     self.ajaxInfinite(next_page);    
135                 }    
136             });    
137         },    
138     
139         ajaxInfinite: function (submitUrl) {    
140             var self = this;    
141             infinite_loaded_count++;    
142             $('.infinite-loader .btn-load-more').hide();    
143             $('.infinite-loader .loading').fadeIn(300);    
144             $.ajax({    
145                 url: submitUrl,    
146                 data: {isAjax: 1},    
147                 type: 'post',    
148                 dataType: 'json',    
149                 beforeSend: function () {    
150                     $('.infinite-loader .btn-load-more').hide();    
151                     $('.infinite-loader .loading').fadeIn(300);    
152                 },    
153                 success: function (res) {    
154                     loading = false;    
155                     if (res.backUrl) {    
156                         window.location = res.backUrl;    
157                         return;    
158                     }    
159                     if (res.products) {    
160                         if($(res.products).find('div.products-grid')){    
161                             var items_grid = $(res.products).find('div.products-grid.wrapper .product-items .item');    
162                             $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_grid);    
163                             $(self.options.productsListSelector).trigger('contentUpdated');    
164                         }    
165                         if($(res.products).find('div.products-list')){    
166                             var items_list = $(res.products).find('div.products-list.wrapper .product-items .item');    
167                             $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_list);    
168                             $(self.options.productsListSelector).trigger('contentUpdated');    
169                         }    
170                         if($(res.products).find('.pages a.next').length > 0){    
171                             $(self.options.productsListSelector + ' .pages a.next').attr('href', $(res.products).find('.pages a.next').attr('href'));    
172                         }else{    
173                             $(self.options.productsListSelector + ' .pages a.next').remove();    
174                         }    
175                         if($("form[data-role=tocart-form]").length > 0) {    
176                             $("form[data-role=tocart-form]").catalogAddToCart();    
177                         }    
178                         $('.main .products.grid .product-items li.product-item:nth-child(2n)').addClass('nth-child-2n');    
179                         $('.main .products.grid .product-items li.product-item:nth-child(2n+1)').addClass('nth-child-2np1');    
180                         $('.main .products.grid .product-items li.product-item:nth-child(3n)').addClass('nth-child-3n');    
181                         $('.main .products.grid .product-items li.product-item:nth-child(3n+1)').addClass('nth-child-3np1');    
182                         $('.main .products.grid .product-items li.product-item:nth-child(4n)').addClass('nth-child-4n');    
183                         $('.main .products.grid .product-items li.product-item:nth-child(4n+1)').addClass('nth-child-4np1');    
184                         $('.main .products.grid .product-items li.product-item:nth-child(5n)').addClass('nth-child-5n');    
185                         $('.main .products.grid .product-items li.product-item:nth-child(5n+1)').addClass('nth-child-5np1');    
186                         $('.main .products.grid .product-items li.product-item:nth-child(6n)').addClass('nth-child-6n');    
187                         $('.main .products.grid .product-items li.product-item:nth-child(6n+1)').addClass('nth-child-6np1');    
188                         $('.main .products.grid .product-items li.product-item:nth-child(7n)').addClass('nth-child-7n');    
189                         $('.main .products.grid .product-items li.product-item:nth-child(7n+1)').addClass('nth-child-7np1');    
190                         $('.main .products.grid .product-items li.product-item:nth-child(8n)').addClass('nth-child-8n');    
191                         $('.main .products.grid .product-items li.product-item:nth-child(8n+1)').addClass('nth-child-8np1');    
192                         var hist = submitUrl;    
193                         if(submitUrl.indexOf("p=") > -1){    
194                             var len = submitUrl.length-submitUrl.indexOf("p=");    
195                             var str_temp = submitUrl.substr(submitUrl.indexOf("p="),len);    
196                             var page_param = "";    
197                             if(str_temp.indexOf("&") == -1){    
198                                 page_param = str_temp;    
199                             } else {    
200                                 page_param = str_temp.substr(0,str_temp.indexOf("&"));    
201                             }    
202                             hist = submitUrl.replace(page_param, "");    
203                         }    
204                         if (typeof window.history.pushState === 'function') {    
205                             window.history.pushState({url: hist}, '', hist);    
206                         }    
207                         if(typeof enable_quickview != 'undefined' && enable_quickview == true) {    
208                             requirejs(['jquery', 'weltpixel_quickview' ],    
209                                 function($, quickview) {    
210                                     $('.weltpixel-quickview').off('click').on('click', function() {    
211                                         var prodUrl = $(this).attr('data-quickview-url');    
212                                         if (prodUrl.length) {    
213                                             quickview.displayContent(prodUrl);    
214                                         }    
215                                     });    
216                                 });    
217                         }    
218                         $(".products-grid .weltpixel-quickview").each(function(){    
219                             $(this).appendTo($(this).parent().parent().children(".product-item-photo"));    
220                         });    
221                         $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"});    
222                         if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) {    
223                             $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('initialized.owl.carousel', function() {    
224                                 $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear');    
225                             });    
226                             $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() {    
227                                 $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear');    
228                             });    
229                         }    
230                         next_page = "";    
231                         $(".pages-items li > a.next").each(function(){    
232                             next_page = $(this).attr("href");    
233                         });    
234                         if(infinite_loaded_count >= 2){    
235                             $('.infinite-loader .loading').hide();    
236                             if(next_page){    
237                                 $('.infinite-loader .btn-load-more').show();    
238                                 $(".infinite-loader .btn-load-more").unbind("click").click(function(){    
239                                     if(!loading && next_page && infinite_loaded_count >= 2){    
240                                         loading = true;    
241                                         self.ajaxInfinite(next_page);    
242                                     }    
243                                 });    
244                             }    
245                         } else {    
246                             $('.infinite-loader .loading').fadeOut(300);    
247                         }    
248                     }    
249     
250                 },    
251                 error: function () {    
252                     window.location.reload();    
253                 }    
254             });    
255         },    
256     
257         ajaxSubmit: function (submitUrl) {    
258             var self = this;    
259             infinite_loaded_count = 0;    
260             $.ajax({    
261                 url: submitUrl,    
262                 data: {isAjax: 1},    
263                 type: 'post',    
264                 dataType: 'json',    
265                 beforeSend: function () {    
266                     $('.ln_overlay').show();    
267                     if (typeof window.history.pushState === 'function') {    
268                         window.history.pushState({url: submitUrl}, '', submitUrl);    
269                     }    
270                 },    
271                 success: function (res) {    
272                     if (res.backUrl) {    
273                         window.location = res.backUrl;    
274                         return;    
275                     }    
276                     if (res.navigation) {    
277                         $(self.options.navigationSelector).replaceWith(res.navigation);    
278                         $(self.options.navigationSelector).trigger('contentUpdated');    
279                     }    
280                     if (res.products) {    
281                         $(self.options.productsListSelector).replaceWith(res.products);    
282                         $(self.options.productsListSelector).trigger('contentUpdated');    
283                     }    
284                     $('.ln_overlay').hide();    
285                     if(typeof enable_quickview != 'undefined' && enable_quickview == true) {    
286                         requirejs(['jquery', 'weltpixel_quickview' ],    
287                         function($, quickview) {    
288                             $('.weltpixel-quickview').off('click').on('click', function() {    
289                                 var prodUrl = $(this).attr('data-quickview-url');    
290                                 if (prodUrl.length) {    
291                                     quickview.displayContent(prodUrl);    
292                                 }    
293                             });    
294                         });    
295                     }    
296                     $(".products-grid .weltpixel-quickview").each(function(){    
297                         $(this).appendTo($(this).parent().parent().children(".product-item-photo"));    
298                     });    
299                     $("#layer-product-list img.porto-lazyload").lazyload({effect:"fadeIn"});    
300                     if ($('#layer-product-list .porto-lazyload').closest('.owl-carousel').length) {    
301                         $('#layer-product-list .porto-lazyload').closest('.owl-carousel').on('changed.owl.carousel', function() {    
302                             $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear');    
303                         });    
304                     }    
305                 },    
306                 error: function () {    
307                     window.location.reload();    
308                 }    
309             });    
310         }    
311     });    
312     
313     return $.mageplaza.layer;    
314 });